package com.edgardeng.consumer;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import java.io.IOException;

/**
 * 定义消费者
 */
@Component
@PropertySource("classpath:rabbitmq.properties")
@RabbitListener(queues = "${com.edgardeng.queue.third}")
public class ThirdConsumer {

    @RabbitHandler
    public void process(String content) throws IOException {
        // 生产者发送了一个对象，接收者通过Payload  获取
        System.out.println("[Third Consumer] process receive:" + content );
    }
}
